﻿using UnityEngine;
using System.Collections;

namespace Baiyy {
	namespace Proceduar {
		/// <summary>
		/// 基础流程。
		/// </summary>
		public class BaseProceduar {
			#region vars
			internal static BaseProceduar sProceduar;
			internal string _name;
			#endregion

			#region getter&setter
			public string name { get { return _name; } set { _name = value; } }
			#endregion

			#region methods
			public BaseProceduar() {
			}

			/// <summary>
			/// 切换流程。
			/// </summary>
			/// <param name="proceduar">Proceduar.</param>
			public static void Switch(BaseProceduar proceduar) {
				if (sProceduar != null) {
					Console.Debug ("[BaseProceduar Leave]: " + sProceduar.name);
					sProceduar.Leave ();
				}
				sProceduar = proceduar;
				if (sProceduar != null) {
					Console.Debug ("[BaseProceduar Enter]: " + sProceduar.name);
					sProceduar.Enter ();
				}
			}
			#endregion

			#region virtuals
			/// <summary>
			/// 进入流程。
			/// </summary>
			public virtual void Enter() {
			}
			/// <summary>
			/// 更新流程。
			/// </summary>
			public virtual void Update() {
			}
			/// <summary>
			/// 离开流程。
			/// </summary>
			public virtual void Leave() {
			}
			#endregion
		}
	}
}
